const app = getApp();
const { AskPage } = app._require("common/index");
AskPage({
    data: {
        navBarHeight: app.globalData.navBarHeight,//导航栏高度
        resourceData: []
    },
    onLoad: function (options) {
    },
    onPullDownRefresh: function () {
        this.getData();
    },
    onShow: function () {
        this.getData();
    },
    async getData() {
        const response = await this.$_server("statistics/getResourceCount", {
            params: {
                cityCode: app.user.userInfo,
            },
        });
        let { data } = response;
        let arr = data.data.filter((item) => {
            return item.children && item.children.length > 0;
        });
        try {
            this.setData({
                resourceData: arr,
            });
        } catch (e) {}
    },
    toList(e) {
        const { item, pitem } = e.currentTarget.dataset
        wx.navigateTo({
            url: `/pages/resource-search/list/index?pid=${pitem.id}&pname=${pitem.name}&name=${item.name}&id=${item.id}&field=${item.field}`
        })
    }
});
